#include <stdio.h>
#define MAX 120

void trans_to_num(char s[],int num[])
{
	int length=strlen(s);	// the length of this big int
	int i;
	memset(num,0,sizeof(int)*MAX);
	for(i=0;i<length;i++)	num[i]=s[length-1-i] - '0';
}

// to add a to b, and store the result in res
void bign_plus(int a[], int b[], int res[]){
	int i,t;
	int length=MAX-1;
	for(i=0;i<length+10;i++){
		t=a[i]+b[i];
		res[i+1]+=t/10;res[i]=t%10;
	}
}

void output_bign(int res[])
{
	int i;
	for(i=MAX-1;i>=0&&!res[i];i--);
	if(i==-1)	printf("0");
	for(;i>=0;i--)	printf("%d",res[i]);
}

int main(){
	// declare 
	char s[MAX]="";	// used for store the input
	int num[MAX]={};	// store the num readed
	int sum[MAX]={};	// store for t
	
	while(1){
	// prompt for input
		scanf("%s",s);
		
	// break condition
		if(s[0]=='0' && s[1]==0)	break;
		else{
		// trans s to nums.
		trans_to_num(s,num);
		
		// calculation
		bign_plus(sum,num,sum);
		}
	}
	
	output_bign(sum);
	
	getch();
	return 0;
}
